<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <ul>
        <li>wwwwwwwww1</li>
        <li>eeeeeeeee2</li>
        <li>rrrrrrrrr3</li>
        <li>qqqqqqqqq4</li>
    </ul>
    <ol id = 'ol'>
        <li>1111</li>
        <li>2222</li>
        <li>3333</li>
        <li>4444</li>
    </ol>
    <script>
        //获取的是元素对象的集合 以伪数组形式存储
        //这个获取的是整个页面的li元素
        var lis = document.getElementsByTagName('li')
        console.log(lis)

        for (i = 0; i < lis.length; i++) {
            console.log(lis[i])
        }

        var ol = document.getElementById('ol')
        //获取id为ol里面的li元素
        console.log(ol.getElementsByTagName('li'))
    </script>
</body>
</html>